package com.txzt.gaea.config.dm;

class PageParamKit {

    PageParamKit() {
    }

    static long mysqlOffset(boolean offsetStartZero, long start) {
        return start - (long)(offsetStartZero ? 0 : 1);
    }

    static long postgresOffset(boolean offsetStartZero, long start) {
        return start - (long)(offsetStartZero ? 0 : 1);
    }

    static long oracleOffset(boolean offsetStartZero, long start) {
        return start + (long)(offsetStartZero ? 1 : 0);
    }

    static long oraclePageEnd(long offset, long pageSize) {
        return offset + pageSize;
    }

    static long db2sqlOffset(boolean offsetStartZero, long start) {
        return start + (long)(offsetStartZero ? 1 : 0);
    }

    static long db2sqlPageEnd(long offset, long pageSize) {
        return offset + pageSize - 1L;
    }

    static long sqlLiteOffset(boolean offsetStartZero, long start) {
        return start - (long)(offsetStartZero ? 0 : 1);
    }

    static long sqlServerOffset(boolean offsetStartZero, long start) {
        return start + (long)(offsetStartZero ? 1 : 0);
    }

    static long sqlServer2012Offset(boolean offsetStartZero, long start) {
        return start - (long)(offsetStartZero ? 0 : 1);
    }

    static long sqlServerPageEnd(long offset, long pageSize) {
        return offset + pageSize - 1L;
    }
}
